cmake_minimum_required(VERSION 3.5)
project(HkCameraHandler)
add_definitions(-std=c++11)
find_package(OpenCV REQUIRED)
#list append
option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" ON)
list(APPEND SRC_INCLUDE1  ${OpenCV_INCLUDE_DIRS}  . /opt/MVS/include/)
list(APPEND SRC_LIBRARY_DIRS1  ${OpenCV_LIBRARY_DIRS} /opt/MVS/lib/64)
list(APPEND SRC_LIB1  -lMvCameraControl -lpthread ${OpenCV_LIBRARIES})

list(APPEND CMAKE_PREFIX_PATH "/home/maizitian/work/ros-hk-camera/build/install")

include_directories(${SRC_INCLUDE1} )
link_directories(${SRC_LIBRARY_DIRS1})
#set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${head_file})
ADD_LIBRARY(${PROJECT_NAME} SHARED HkCameraHandler.cpp)
target_link_libraries(${PROJECT_NAME} ${SRC_LIB1})

add_executable(${PROJECT_NAME}_test test.cpp HkCameraHandler.cpp)
target_link_libraries(${PROJECT_NAME}_test ${SRC_LIB1})

FILE(GLOB head_file "*.h")

INSTALL(TARGETS ${PROJECT_NAME}
    EXPORT ${PROJECT_NAME}-targets
    LIBRARY DESTINATION lib
    PUBLIC_HEADER DESTINATION include)

INSTALL(FILES ${head_file} DESTINATION include)
INSTALL(EXPORT ${PROJECT_NAME}-targets
    NAMESPACE ${PROJECT_NAME}::
    FILE ${PROJECT_NAME}-config.cmake
    DESTINATION lib/cmake/${PROJECT_NAME})

# uninstall target
if(NOT TARGET uninstall)
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
    add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

